package com.javaee.lpr.util;

import java.io.Serializable;

public class JsonResult<E> implements Serializable {
    private Integer state; // 状态码
    private String Message; // 描述信息(异常)
    private E data; // 返回数据

    public JsonResult() {
    }
    // 成功切无返回
    public JsonResult(Integer state) {
        this.state = state;
    }
    // 成功切有返回
    public JsonResult(Integer state, E data) {
        this.state = state;
        this.data = data;
    }
    // 有异常
    public JsonResult(Exception e) {
        this.Message = e.getMessage();
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMessage() {
        return Message;
    }

    public void setMessage(String message) {
        Message = message;
    }

    public E getData() {
        return data;
    }

    public void setData(E data) {
        this.data = data;
    }
}
